from sqlalchemy import Column, Integer, String, Text, Boolean, Date, DateTime, Time, BigInteger, Numeric, Float
from core.base.orm_model import Base


class Project(Base):
    __tablename__ = "project"

    id = Column(Integer, primary_key=True, nullable=False, comment="项目主键")
    code = Column(String(255), comment="项目代号")
    name = Column(String(255), comment="项目名称")
    case_id = Column(Integer, comment="关联案情ID")
    presale_entry_time = Column(DateTime, comment="售前进入时间")
    presale_pm = Column(String(50), comment="售前PM")
    presale_person = Column(String(50), comment="售前")
    customer_code = Column(String(255), comment="客户编号")
    customer_name = Column(String(100), comment="客户名称")
    salesperson = Column(String(255))
    department = Column(String(50), comment="事业部")
    opportunity_category = Column(String(50), comment="商机类别")
    products = Column(String(100), comment="产品线")
    agile_product_line = Column(String(100), comment="敏态产品")
    project_phase = Column(String(20), comment="项目阶段")
    project_progress = Column(String(20), comment="项目进度")
    factory_progress = Column(String(50), comment="工厂建设状况")
    factory_planning = Column(String(20), comment="工厂规划需求")
    competitors = Column(Text, comment="竞争对手")
    customer_budget = Column(Numeric, comment="客户预算")
    last_update_time = Column(DateTime, comment="最近更新时间")
    recent_notes = Column(Text, comment="近况备注")
    expected_signing_date = Column(Date, comment="预计签约日")
    confidence_level = Column(String(20), comment="把握度")
    high_level_description = Column(Text, comment="高阶论述")
    quote_amount_total = Column(Numeric, comment="报价-总金额")
    signing_status_date = Column(DateTime, comment="签约/战败/暂停日")
    contract_amount_total = Column(Numeric, comment="签约-总金额")
    create_time = Column(DateTime, comment="创建时间")
    update_time = Column(DateTime, comment="更新时间")
    case_report_score = Column(Integer, comment="案情报告总分")
    quality_level = Column(String(20), comment="质量等级")
    quality_score = Column(Integer, comment="质量分数")
    project_authenticity = Column(String(20), comment="项目真伪")
    authenticity_score = Column(Integer, comment="真伪分数")
    win_rate = Column(String(20), comment="项目胜率")
    win_rate_score = Column(Integer, comment="胜率分数")
    erp_status = Column(Text, comment="信息化应用状况")
    mes_status = Column(String(100), comment="MES状况")
    project_scale = Column(String(20), comment="项目规模（纯数值，如人数、金额等）")
    created_by = Column(String(50), comment="创建人")
    updated_by = Column(String(50), comment="更新人")
    created_dept = Column(String(50), comment="创建人部门")
    research_date = Column(Date, comment="调研日期")
    proposal_date = Column(Date, comment="提案日期")
    project_approval_date = Column(Date, comment="立项日期")
    salers_id = Column(Integer, comment="销售人员ID，关联salesperson表")
    is_sprint_project = Column(String(1), comment="冲刺项目否 Y/N")
